<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
>
<head>
    <th:block th:include="common/head::noXadmin('查看资源')"/>
</head>
<body class="layui-layout layui-layout-admin">
<div class="layui-container">
    <form class="layui-form " disabled="disabled">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>基本信息</legend>
        </fieldset>
        <div class="layui-row layui-col-space30 " style="margin: 0px 30px 0px 30px ">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label is-required">上级资源</label>
                    <div class="layui-input-block">
                        <input type="hidden" id="parentId" name="parentId" th:value="${res?.parentId}" readonly>
                        <input type="text" id="parentName" placeholder="上级资源" class="layui-input"
                               th:value="${parent?.resName}" lay-verify="required" readonly="readonly"
                               onclick="loadTree()">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label is-required">资源类型</label>
                    <div class="layui-input-block">
                        <input type="radio" name="resType" value="D" lay-filter="resType" title="目录"
                               th:checked="${res?.resType=='D'}">
                        <input type="radio" name="resType" value="M" lay-filter="resType" title="菜单"
                               th:checked="${res?.resType=='M'}">
                        <input type="radio" name="resType" value="B" lay-filter="resType" title="按钮"
                               th:checked="${res?.resType=='B'}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label is-required">资源名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="resName" autocomplete="off" placeholder="请输入角色名称" class="layui-input"
                               required lay-verify="required" th:value="${res?.resName}">
                    </div>
                </div>

                <div class="layui-form-item f_D">
                    <label class="layui-form-label">请求路径</label>
                    <div class="layui-input-block">
                        <input type="text" name="resPath" placeholder="请求路径"
                               autocomplete="off"
                               class="layui-input" th:value="${res?.resPath}">
                    </div>
                </div>
                <div class="layui-form-item f_D">
                    <label class="layui-form-label">资源标识</label>
                    <div class="layui-input-block">
                        <input type="text" name="resMark" lay-verify="required" placeholder="资源标识"
                               autocomplete="off"
                               class="layui-input" th:value="${res?.resMark}">
                    </div>
                </div>
                <div class="layui-form-item f_D f_B">
                    <label class="layui-form-label  ">打开方式</label>
                    <div class="layui-input-block">
                        <select name="target">
                            <option value="" th:selected="${res?.target==''}">打开方式</option>
                            <option value="TAB" th:selected="${res?.target=='TAB'}">页签</option>
                            <option value="ALERT" th:selected="${res?.target=='ALERT'}">弹窗</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item is-required">
                    <label class="layui-form-label">显示排序</label>
                    <div class="layui-input-block">
                        <input type="number" name="order" value="0" placeholder="排序" autocomplete="off"
                               class="layui-input" lay-verify="required" th:value="${res?.order}">
                    </div>
                </div>
                <div class="layui-form-item f_B">
                    <label class="layui-form-label">图标</label>
                    <div class="layui-input-block">
                        <input type="text" name="icon" value="" placeholder="图标" autocomplete="off"
                               class="layui-input" th:value="${res?.icon}">
                    </div>
                </div>
                <div class="layui-form-item " pane="">
                    <label class="layui-form-label">资源状态</label>
                    <div class="layui-input-block">
                        <input type="hidden" name="visible" id="visible" th:value="${res?.visible}">
                        <input type="checkbox" lay-skin="switch" lay-filter="visible"
                               lay-text="显示|隐藏" value="0" th:checked="${res?.visible eq 0}">
                    </div>
                </div>

            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title">
            <legend>其他信息</legend>
        </fieldset>
        <div class="layui-row" style="margin: 0px 30px 0px 30px ">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" class="layui-textarea" name="remark"
                              th:text="${res?.remark}"></textarea>
                </div>
            </div>
        </div>

    </form>

</div>
<script>

    layui.use(['form', 'layedit', 'laydate', 'jquery'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery
        ;
        $("input").attr("disabled", "disabled")
        $("textarea").attr("disabled", "disabled")
        $("select").attr("disabled", "disabled")
        $(".f_" + $('input[name="resType"]:checked').val()).hide();
        form.render();
    });
</script>

</body>

</html>
